package com.ego.controller;

import com.ego.commons.pojo.EasyUIDatagrid;
import com.ego.commons.pojo.EasyUITree;
import com.ego.commons.pojo.EgoResult;
import com.ego.pojo.TbContent;
import com.ego.service.TbContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Title
 * @Author Lyg
 * @Description:
 */
@RestController
public class TbContentController {

    @Autowired
    private TbContentService tbContentService;

    /**
     * 显示内容
     * @param categoryId
     * @param page
     * @param rows
     * @return
     */

    @GetMapping("/content/query/list")
    public EasyUIDatagrid contentQueryList(long categoryId, int page, int rows){
        return tbContentService.contentListPage(categoryId,page,rows);
    }
    @RequestMapping("/content/save")
    public EgoResult insertSelective(TbContent content){
        return tbContentService.insertSelective(content);
    }

    @RequestMapping("/rest/content/edit")
    public EgoResult editContent(TbContent content){
        return tbContentService.editContent(content);
    }

    @PostMapping("/content/delete")
    public EgoResult delete(@RequestParam List<Long> ids){
        return tbContentService.deleteByIds(ids);
    }
}
